﻿using MediatR;
using T.Vehicleservice.API.Application.Command.MaintenanceRecordCommand;
using T.Vehicleservice.Repository.Interface;

namespace T.Vehicleservice.API.Application.CommandHandlers.MaintenanceRecordCommandHander
{
    /// <summary>
    /// 新增保养记录
    /// </summary>
    public class MaintenanceRecordCreateCommandHandler : IRequestHandler<MaintenanceRecordCreateCommand, int>
    {
        private readonly IMaintenanceRecordRepository _maintenanceRecordRepository;
        public MaintenanceRecordCreateCommandHandler(IMaintenanceRecordRepository managementRecordRepository)
        {
            _maintenanceRecordRepository = managementRecordRepository;
        }
        public async Task<int> Handle(MaintenanceRecordCreateCommand request, CancellationToken cancellationToken)
        {
            return await _maintenanceRecordRepository.AddAsync(request);
        }
    }
}
